package com.student.utils;

import javax.swing.*;
import java.awt.*;

public class Tools {
    public static void setPos(JFrame jFrame,int width,int height)
    {//实现窗口居中
        Toolkit tk =Toolkit.getDefaultToolkit();
        Dimension screenSize =tk.getScreenSize();
        int x=(int)screenSize.getWidth()/2-width/2;
        int y=(int)screenSize.getHeight()/2-height/2;
        jFrame.setBounds(x,y,width,height);
    }
    //弹窗封装的方法
    public static void showMessage(String message){
        JOptionPane.showConfirmDialog(null,message,"提示信息",JOptionPane.WARNING_MESSAGE);
    }
}
